#ifndef EPOLL_POLLER_H
#define EPOLL_POLLER_H

#include "channel.h"
#include "poller.h"
#include <sys/epoll.h>
#include <unordered_map>
#include <vector>
class EpollPoller : public Poller {
public:
    EpollPoller();
    ~EpollPoller();

    void poll(int timeoutMs, std::vector<Channel*>& activeChannels) override;
    void updateChannel(Channel* channel) override;
    void removeChannel(Channel* channel) override;

    int getEpollFd() const { return epollfd_; }
private:
    int epollfd_;
    std::unordered_map<int, Channel*> channels_;
    std::vector<epoll_event> events_;
};

#endif